#coding=utf-8
from tornado_json.requesthandlers import APIHandler
from project.tools import HandlerMixin, ApiMixin, unblock
from project.models import User

class BaseApiHandler(HandlerMixin, ApiMixin, APIHandler):
    """
    基本的handler
    """
    @unblock
    def get_user(self):
        """
        获取当前用户
        :return:
        """
        user_id = self.get_current_user()
        user = self.db_conn.query(User).filter(User.user_id == user_id).first()
        return user
